package cn.edu.hqu.cst.android.ljc.sensor;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.alibaba.android.arouter.launcher.ARouter;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MainActivity extends AppCompatActivity {

    @BindView(R.id.bt_main_gravity)
    Button bt_main_gravity;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ARouter.openLog();
        ARouter.openDebug();//消除ARouter的缓存
        ARouter.init(getApplication());
        ButterKnife.bind(this);
    }

    @OnClick({R.id.bt_main_gravity, R.id.bt_main_linear_accel, R.id.bt_main_ambient_temp})
    void SensorTest(View v) {
        switch (v.getId()) {
            case R.id.bt_main_gravity://通过注解实现实例的创建
                ARouter.getInstance().build("/app/GravityActivity").navigation();
                break;
            case R.id.bt_main_linear_accel:
                ARouter.getInstance().build("/app/LinearAccelActivity").navigation();
                break;
            case R.id.bt_main_ambient_temp:
                ARouter.getInstance().build("/app/AmbientActivity").navigation();
                break;
        }
    }
}